#include "usermanage.h"
#include "ui_usermanage.h"
#include <QDebug>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonValue>
#include <QFile>
#include <QDir>
#include <QComboBox>
#include <QPushButton>
#include "newuser.h"
#include <QListView>
#include <QStyledItemDelegate>
#include <QPushButton>
#include <QCompleter>
#include <QLineEdit>
#include <QStringListModel>
#include <QGraphicsDropShadowEffect>
#include "mainwindow.h"
#include "mythread.h"
#include "messagepops.h"
#include "amenduser.h"
#include <QScrollBar>
#include "deviceitem.h"
#include <QBitmap>
#include "operateitem.h"
#include "lcombobox.h"
#include "operationdocument.h"
#include "function/function.h"

QStringList accountUid;//保存所有用户指静脉id信息

//用户管理界面
UserManage::UserManage(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::UserManage)
{
    ui->setupUi(this);

    this->setParent(parent);
    this->setWindowFlags(Qt::CustomizeWindowHint|Qt::FramelessWindowHint);
//    this->setWindowFlags(Qt::Window);//将子窗口设置为非顶级窗口
    this->hide();

    RowCount = 15;
    initialize();//初始化界面

    //遮罩窗口突出显示弹窗
    mpShadeWindow = new QWidget(parent);
    QString str("QWidget{background-color:rgba(51,51,51,0.4);}");
    mpShadeWindow->setStyleSheet(str);
    mpShadeWindow->setGeometry(0, 0, 1, 1);
    mpShadeWindow->hide();


    thread=new mythread(this); //初始化线程对象
    thread->isUid(2);
    thread->isUid(22);
    mps=new MessagePops(this);//初始化提示窗口对象
    mps->setWindowFlags(Qt::FramelessWindowHint|Qt::Window);   //设置无边框窗口
    mps->hide();
//    connect(mps,SIGNAL(sendMessage(QString)),this,SLOT(receMessage(QString)));

    mps2=new MessagePops(this);//初始化提示窗口对象
    mps2->setWindowFlags(Qt::FramelessWindowHint|Qt::Window);   //设置无边框窗口
//    mps2->setGeometry(580,150,470,610);//设置坐标和宽高
    mps2->hide();
    connect(mps2,SIGNAL(sendMessage(QString)),this,SLOT(receMessage2(QString)));


}

UserManage::~UserManage()
{
    delete ui;
}

//初始化界面
void UserManage::initialize()
{
    //部件事件过滤的注册
    ui->pushButton->installEventFilter(this);
    ui->pushButton_2->installEventFilter(this);
    ui->pushButton_3->installEventFilter(this);
    ui->comboBox->installEventFilter(this);
    ui->comboBox_2->installEventFilter(this);
    ui->pbl->installEventFilter(this);
    ui->pbr->installEventFilter(this);
    ui->pb1->installEventFilter(this);
    ui->pb2->installEventFilter(this);
    ui->pb3->installEventFilter(this);
    ui->pb4->installEventFilter(this);
    ui->pb5->installEventFilter(this);


    lComboBox = new LComboBox(this);
    lComboBox->setGeometry(135,26,150,30);
    lComboBox->setTop(15);
    QStringList list2;
    list2<<"全部"<<"管理员"<<"主任"<<"护士"<<"毒麻管理护士";
    lComboBox->setTexe(list2);

    lComboBox2 = new LComboBox(this);
    lComboBox2->setGeometry(445,26,150,30);
    QStringList list3;
    list3<<"全部"<<"已启用"<<"已禁用";
    lComboBox2->setTexe(list3);

    connect(lComboBox,SIGNAL(sendLComboBox(int,QString)),this,SLOT(receLComboBox(int,QString)));
    connect(lComboBox2,SIGNAL(sendLComboBox(int,QString)),this,SLOT(receLComboBox(int,QString)));

    //设置QComboBox样式
    setcomboBox(ui->comboBox);
    setcomboBox(ui->comboBox_2);

    //设置新建按钮图片
    ui->pushButton->setIcon(QPixmap(":/new/prefix1/resource/11.png"));

    QFont font;
    font.setFamily(QStringLiteral("Microsoft YaHei"));//设置字体
    font.setPixelSize(16);//字体大小
    font.setLetterSpacing(QFont::PercentageSpacing,120);//120字间距，默认100

    ui->label->setFont(font);
    ui->label_2->setFont(font);
    ui->label_3->setFont(font);
    ui->label_4->setFont(font);
    ui->lineEdit->setFont(font);
    ui->lineEdit_2->setFont(font);

    {
        QIcon icon;
        icon.addFile(tr(":/new/prefix1/resource/12.png"));
        ui->pbl->setIcon(icon);
        ui->pbl->setStyleSheet("border: 1px solid #999999;border-radius: 10px;");

        QPixmap icon1(tr(":/new/prefix1/resource/13.png"));
        ui->pbr->setIcon(icon1);
    //    ui->pbr->setFixedSize(icon1.size());

        connect(ui->pb1,SIGNAL(clicked()),this,SLOT(FlipOver()));
        connect(ui->pb2,SIGNAL(clicked()),this,SLOT(FlipOver()));
        connect(ui->pb3,SIGNAL(clicked()),this,SLOT(FlipOver()));
        connect(ui->pb4,SIGNAL(clicked()),this,SLOT(FlipOver()));
        connect(ui->pb5,SIGNAL(clicked()),this,SLOT(FlipOver()));

        PB[0] = ui->pb1;
        PB[1] = ui->pb2;
        PB[2] = ui->pb3;
        PB[3] = ui->pb4;
        PB[4] = ui->pb5;

        connect(ui->pbl,SIGNAL(clicked()),this,SLOT(LeftOver()));
        connect(ui->pbr,SIGNAL(clicked()),this,SLOT(RightOver()));

        showButton();
    }
    {
        //设置常规药品字段名
        ui->tableWidget->setColumnCount(9); //设置列数为11
    //    ui->tableWidget->setHorizontalHeaderLabels(QStringList()<<"药品名"<<"规格"<<"数量");

        //设置表格的行数
        ui->tableWidget->verticalHeader()->setVisible(false); //隐藏列表头
        ui->tableWidget->horizontalHeader()->setVisible(false); //隐藏行表头
        ui->tableWidget->setRowCount(RowCount);


        //设置每列长度
//        ui->tableWidget->setColumnWidth(0,100);
//        ui->tableWidget->setColumnWidth(1,80);
//        ui->tableWidget->setColumnWidth(2,80);
//        ui->tableWidget->setColumnWidth(3,80);
//        ui->tableWidget->setColumnWidth(4,99);
//        ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);/* 自适应所有列，让它布满空间 */
        ui->tableWidget->setColumnWidth(0,120);
        ui->tableWidget->setColumnWidth(1,180);
        ui->tableWidget->setColumnWidth(2,130);
        ui->tableWidget->setColumnWidth(3,120);
        ui->tableWidget->setColumnWidth(4,120);
        ui->tableWidget->setColumnWidth(5,180);
        ui->tableWidget->setColumnWidth(6,180);
        ui->tableWidget->setColumnWidth(7,120);

        ui->tableWidget->setColumnWidth(8,330);
//        ui->tableWidget->setColumnWidth(9,110);
//        ui->tableWidget->setColumnWidth(10,110);

        ui->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);//隐藏上下滚动条
        ui->tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);//隐藏左右滚动条
        ui->tableWidget->setFocusPolicy(Qt::NoFocus);//解决选中虚框问题(选中后变灰一点)
        ui->tableWidget->setSelectionMode(QAbstractItemView::NoSelection);// 不能选择单元格
        ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);//禁止编辑
        ui->tableWidget->verticalHeader()->setDefaultSectionSize(40);//可以设置tableview所有列的默认行高为40
    }

    QStringList headerText;
    headerText<<"姓名"<<"权限"<<"账号"<<"指静脉"<<"电子签名"<<"联系方式"<<"创建时间"<<"用户状态"<<"操作";
    QTableWidget *Headline = new QTableWidget(this);
    userDefinedHeadline(ui->tableWidget, Headline, headerText);
//    Headline->setSpan(0, 8, 1, 3); //合并单元格  要改变单元格的   第一个单元格  行数  列数     要合并的  几行  几列
}

//自定义标题
void UserManage::userDefinedHeadline(QTableWidget *tableWidget, QTableWidget *Headline, QStringList headerText)
{
    QFont font;
    font.setFamily("Microsoft YaHei");//设置字体
    //设置为粗体
    font.setBold(true);
    //字体大小
    font.setPixelSize(16);
    font.setLetterSpacing(QFont::PercentageSpacing,130);//120字间距，默认100

//    int iRow = tableWidget->rowCount();//行数
    int iColumn = tableWidget->columnCount();//列数
    int iWidth = tableWidget->width();//宽度
    int iX = tableWidget->x();//x轴坐标
    int iY = tableWidget->y();//x轴坐标

    //设置表格的行数
    Headline->verticalHeader()->setVisible(false); //隐藏列表头
    Headline->horizontalHeader()->setVisible(false); //隐藏行表头
    Headline->setRowCount(1);

    Headline->verticalHeader()->setDefaultSectionSize(40);//可以设置tableview所有列的默认行高为32
    Headline->setEditTriggers(QAbstractItemView::NoEditTriggers);//禁止编辑
    Headline->verticalScrollBar()->setDisabled(true); // 禁用滚动
    Headline->horizontalScrollBar()->setDisabled(true); // 禁用滚动
    Headline->setAutoScroll(false);//去掉自动滚动
    tableWidget->verticalScrollBar()->setDisabled(true); // 禁用滚动
    tableWidget->horizontalScrollBar()->setDisabled(true); // 禁用滚动
    tableWidget->setAutoScroll(false);//去掉自动滚动


    Headline->setColumnCount(iColumn); //设置列数
//    Headline->setHorizontalHeaderLabels(headerText);//设置标题
    Headline->setGeometry(iX,iY-40,iWidth,40);//设置位置和大小

//    Headline->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);/* 自适应所有列，让它布满空间 */
    //设置每列长度
    Headline->setColumnWidth(0,120);
    Headline->setColumnWidth(1,180);
    Headline->setColumnWidth(2,130);
    Headline->setColumnWidth(3,120);
    Headline->setColumnWidth(4,120);
    Headline->setColumnWidth(5,180);
    Headline->setColumnWidth(6,180);
    Headline->setColumnWidth(7,120);

    Headline->setColumnWidth(8,330);
//    Headline->setColumnWidth(9,110);
//    Headline->setColumnWidth(10,110);

    Headline->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);//隐藏上下滚动条
    Headline->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);//隐藏左右滚动条
    Headline->setFocusPolicy(Qt::NoFocus);//解决选中虚框问题(选中后变灰一点)
    Headline->setSelectionMode(QAbstractItemView::NoSelection);// 不能选择单元格

    tableWidget->setStyleSheet("QTableWidget {padding: 1px;border: none;\
    border-left: 1px solid #999999;\
    border-right: 1px solid #999999;\
    border-top: 1px solid #cccccc;\
    border-bottom: 1px solid #999999;}\
    ");

    //设置表格边逛
    Headline->setStyleSheet("QTableWidget {padding: 1px;border: none;\
    border-left: 1px solid #999999;\
    border-right: 1px solid #999999;\
    border-top: 1px solid #999999;\
    border-bottom: 0px solid gray;}\
    ");//QTableWidget::item{padding-left:20px;border:0;}



    //添加正文内容  设置标题
    for(int i=0; i<headerText.size(); i++)
    {
        QTableWidgetItem *qtwi=new QTableWidgetItem();
        qtwi->setText(headerText.at(i));//设置单元格中的文本
//        qtwi->setFlags(qtwi->flags() & ~Qt::ItemIsSelectable);//表格不可被选中
        qtwi->setBackground(QBrush("#F1F6F9"));//设置单元格的背景
        qtwi->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
//        qtwi->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);//设置单元格中文本的对齐方式
        qtwi->setFont(font);//设置单元格中文本的字体
        Headline->setItem(0,i,qtwi);
    }





//    //设置垂直滚动条的样式
//    tableWidget->setStyleSheet("QScrollBar{background:transparent; width: 5px;}"                                  //设置滚动条大小
//             "QScrollBar::handle{background: rgb(255, 170, 127); border:2px solid transparent; border-radius:2px;}"     //设置滚动条颜色，填充大小，圆角
//             "QScrollBar::handle:hover{background:gray;}"
//             "QScrollBar::sub-line{background:transparent;}"
//             "QScrollBar::add-line{background:transparent;}");
}

//解析显示医护人员数据
void UserManage::analysisMedicalWorkers(QByteArray Data, int location_)
{
    QFont font;
    font.setFamily(QStringLiteral("Microsoft YaHei"));//设置字体
    font.setPixelSize(16);//字体大小
    font.setWeight(QFont::Normal);//设置文字粗细
    font.setLetterSpacing(QFont::PercentageSpacing,120);//120字间距，默认100

    sign1 = 0;
    signature_pathNumber2 = 0;
    ui->tableWidget->setRowCount(0);
    ui->tableWidget->setRowCount(RowCount);

    //获取QComboBox列表项的当前项的文字
//    QString permission = comboBoxText(ui->comboBox);//权限
    QString permission = comboBoxText(lComboBox);//权限
    QString state = comboBoxText(lComboBox2);//用户状态
    QString name = ui->lineEdit->text();//姓名
    QString account = ui->lineEdit_2->text();//账号

    ui->tableWidget->clear();//清除内容，重新匹配

    medicalWorkersData = Data;
    //把获取的json数据标准化存储
    QJsonParseError myerr;
    QJsonDocument mydoc=QJsonDocument::fromJson(medicalWorkersData,&myerr);

    //获取最外面的对象
    QJsonObject obj=mydoc.object();

     //继续获取键值对中的键和值(数组)
 //   QJsonObject  obj1=obj.toObject();
    QJsonArray val=obj.value("data").toArray();
    valDigitalVeinUser=val;
//qDebug()<<__LINE__<<valDigitalVeinUser;
//    int ifsign = 0;
    int number = 0;//记录人数
    for(int i=0; i<val.size(); i++)
    {
        QJsonObject  obj1=val.at(i).toObject();

        //obj1存放的就是数组中一个医护人员信息
        QJsonValue val1=obj1.value("position");

        QString real_name = obj1.value("real_name").toString();
        if(!real_name.contains(name))   continue;

        QString role = obj1.value("role").toString();
        if(permission != "全部")
        {
            if(!role.contains(permission))   continue;
        }

        QString username = obj1.value("username").toString();
        if(!username.contains(account))   continue;

        int is_disable = obj1.value("is_disable").toInt();
        if(state != "全部")
        {
            if(is_disable==0)
            {
                if(state == "已禁用")
                    continue;
            }
            else if(is_disable==1)
            {
                if(state == "已启用")
                    continue;
            }
        }


//        int iRow = ui->tableWidget->rowCount();
//        ui->tableWidget->setRowCount(iRow + 1);//总行数增加1
//        //添加姓名
//        QTableWidgetItem *qtwi=new QTableWidgetItem();

//        qtwi->setText(real_name);//设置单元格中的文本
//        qtwi->setFont(font);
//        qtwi->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
//        qtwi->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
//        ui->tableWidget->setItem(sign1,0,qtwi);


//        //权限 身份
//        QTableWidgetItem *qtwi2=new QTableWidgetItem();

//        qtwi2->setText(role);//设置单元格中的文本
//        qtwi2->setFont(font);
//        qtwi2->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
//        qtwi2->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
//        ui->tableWidget->setItem(sign1,1,qtwi2);

//        //账号
//        QTableWidgetItem *qtwi3=new QTableWidgetItem();

//        qtwi3->setText(username);//设置单元格中的文本
//        qtwi3->setFont(font);
//        qtwi3->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
//        qtwi3->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
//        ui->tableWidget->setItem(sign1,2,qtwi3);

//        //指静脉
//        QTableWidgetItem *qtwi4=new QTableWidgetItem();
//        QString iffingerprint_path = obj1.value("fingerprint_path").toString();
//        if(iffingerprint_path.isEmpty())
//        {
////            qtwi4->setText("无");//设置单元格中的文本
//        }
//        else
//        {
//            qtwi4->setText("有");//设置单元格中的文本
//        }
//        qtwi4->setFont(font);
//        qtwi4->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
//        qtwi4->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
//        ui->tableWidget->setItem(sign1,3,qtwi4);

//        if(ifsign == 0)
//        {
//            //电子签名
////            QTableWidgetItem *qtwi5=new QTableWidgetItem();
//            QString ifsignature_path = obj1.value("signature_path").toString();
//            if(!ifsignature_path.isEmpty())
//            {
//                ifsign = 1;
//                signature_pathNumber = i+1;
//                QString URL_Name=QString("%1%2").arg("http://192.168.3.109:8888/upload/").arg(ifsignature_path);//获取文件http网址

//                QNetworkAccessManager *manager=new QNetworkAccessManager(this);
//    //            connect(&manager,SIGNAL(finished(QNetworkReply *)),this,SLOT(recvhttp(QNetworkReply *)));//关联finished信号

//                QUrl url(URL_Name);
//                //创建http请求
//                QNetworkRequest req(url);
//    //             req.setRawHeader("token",bytes);
//                //发送该请求
//                reply=manager->get(req);

//    //            receDigitalVeinUser++;
//                //下面关联信号和槽
//                connect(reply,SIGNAL(finished()),this,SLOT(httpFinished()));//下载完成后
//                connect(reply,SIGNAL(readyRead()),this,SLOT(httpReadyRead()));//有可用数据时
//            }
//            else
//            {
//                signature_pathNumber2++;
//            }
//        }

//        //联系方式
//        QTableWidgetItem *qtwi6=new QTableWidgetItem();
//        qtwi6->setText(obj1.value("phone").toString());//设置单元格中的文本
//        qtwi6->setFont(font);
//        qtwi6->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
//        qtwi6->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
//        ui->tableWidget->setItem(sign1,5,qtwi6);

//        //创建时间
//        QTableWidgetItem *qtwi7=new QTableWidgetItem();
//        QString create_time = obj1.value("create_time").toString();
//        QStringList create = create_time.split("T");
//        if(create.size() >= 2)
//        {
//            QString createT = create.at(0);
//            QStringList creates = create.at(1).split(":");
//            if(creates.size() >= 2)
//            {
//                QString createS = creates.at(0)+":"+creates.at(1);
//                qtwi7->setText(QString("%1 %2").arg(createT).arg(createS));//设置单元格中的文本
//                qtwi7->setFont(font);
//                qtwi7->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
//                qtwi7->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
//                ui->tableWidget->setItem(sign1,6,qtwi7);
//            }

//        }


//        //用户状态
//        QTableWidgetItem *qtwi8=new QTableWidgetItem();

//        if(is_disable==0)
//        {
//            qtwi8->setText("已启用");//设置单元格中的文本
//        }
//        else
//        {
//            qtwi8->setText("已禁用");
//        }
//        qtwi8->setFont(font);
//        qtwi8->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
//        qtwi8->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
//        ui->tableWidget->setItem(sign1,7,qtwi8);


//        // 创建QPushButton控件
//        QPushButton *pBtn = new QPushButton();
//        if(is_disable==0)
//        {
//            pBtn->setText("禁用");
//            pBtn->setStyleSheet("background:rgba(255, 255, 255, 0%);color: rgb(27, 137, 204);");
//            pBtn->setFont(font);
//        }
//        else
//        {
//            pBtn->setText("启用");
//            pBtn->setStyleSheet("background:rgba(255, 255, 255, 0%);color: rgb(27, 137, 204);");
////            font.setFamily("启用");
//            pBtn->setFont(font);
//        }
//        // 绑定信号
//        connect(pBtn, SIGNAL(clicked(bool)), this, SLOT(OnBtnClicked()));
//        // 在QTableWidget中添加控件
//        ui->tableWidget->setCellWidget(sign1,8,pBtn);

//        // 创建QPushButton控件
//        QPushButton *pBtn2 = new QPushButton();
//        pBtn2->setText("重置密码");
//        pBtn2->setStyleSheet("background:rgba(255, 255, 255, 0%);color: rgb(27, 137, 204);");
//        pBtn2->setFont(font);
//        // 绑定信号
//        connect(pBtn2, SIGNAL(clicked(bool)), this, SLOT(OnBtnClicked2()));
//        // 在QTableWidget中添加控件
//        ui->tableWidget->setCellWidget(sign1,9,pBtn2);

//        // 创建QPushButton控件
//        QPushButton *pBtn3 = new QPushButton();
//        pBtn3->setText("修改信息");
//        pBtn3->setStyleSheet("background:rgba(255, 255, 255, 0%);color: rgb(27, 137, 204);");
//        pBtn3->setFont(font);
//        // 绑定信号
//        connect(pBtn3, SIGNAL(clicked(bool)), this, SLOT(OnBtnClicked3()));
//        // 在QTableWidget中添加控件
//        ui->tableWidget->setCellWidget(sign1,10,pBtn3);

//        sign1++;
        number++;
    }

    pagination = number/14;
    if(number%14 > 0)
    {
        pagination++;
    }
    qDebug()<<__LINE__<<"pagination="<<pagination;
    setNumber(810,810,36,36,pagination);
    location = location_;
    showButton();

    //刷新指静脉信息，查看是否有新的指静脉文件
    RefreshFingerVein();

    //保存所有用户账号
    accountNumber.clear();
    accountUid.clear();
    for(int i=0; i<val.size(); i++)
    {
        QJsonObject  obj1=val.at(i).toObject();

        //obj1存放的就是数组中一个医护人员信息
        QString username=obj1.value("username").toString();
        int uid = obj1.value("digital_vein_device_id").toInt();
        accountNumber.append(username);
        accountUid.append(QString::number(uid));
    }
}

void UserManage::analysisMedicalWorkers2(QByteArray Data, int page)
{
    int number2 = (page-1)*15;

    QFont font;
    font.setFamily(QStringLiteral("Microsoft YaHei"));//设置字体
    font.setPixelSize(16);//字体大小
    font.setWeight(QFont::Normal);//设置文字粗细
    font.setLetterSpacing(QFont::PercentageSpacing,120);//120字间距，默认100

    sign1 = 0;
    signature_pathNumber2 = 0;
    ui->tableWidget->setRowCount(0);
    ui->tableWidget->setRowCount(RowCount);

    //获取QComboBox列表项的当前项的文字
    QString permission = comboBoxText(lComboBox);//权限
    QString state = comboBoxText(lComboBox2);//用户状态
    QString name = ui->lineEdit->text();//姓名
    QString account = ui->lineEdit_2->text();//账号

    ui->tableWidget->clear();//清除内容，重新匹配

    medicalWorkersData = Data;
    //把获取的json数据标准化存储
    QJsonParseError myerr;
    QJsonDocument mydoc=QJsonDocument::fromJson(medicalWorkersData,&myerr);

    //剥洋葱
    //获取最外面的对象
    QJsonObject obj=mydoc.object();

    //obj存放的就是
     //继续获取键值对中的键和值(数组)
 //   QJsonObject  obj1=obj.toObject();
    QJsonArray val=obj.value("data").toArray();

    int ifsign = 0;
    int number = 0;//记录人数
    for(int i=0; i<val.size(); i++)
    {
        QJsonObject  obj1=val.at(i).toObject();

        //obj1存放的就是数组中一个医护人员信息
        QJsonValue val1=obj1.value("position");

        QString real_name = obj1.value("real_name").toString();
        if(!real_name.contains(name))   continue;

        QString role = obj1.value("role").toString();
        if(permission != "全部")
        {
            if(!role.contains(permission))   continue;
        }

        QString username = obj1.value("username").toString();
        if(!username.contains(account))   continue;

        int is_disable = obj1.value("is_disable").toInt();
        if(state != "全部")
        {
            if(is_disable==0)
            {
                if(state == "已禁用")
                    continue;
            }
            else if(is_disable==1)
            {
                if(state == "已启用")
                    continue;
            }
        }

        number++;
        if(number <= number2)
        {
            continue;
        }
//        int iRow = ui->tableWidget->rowCount();
//        ui->tableWidget->setRowCount(iRow + 1);//总行数增加1
        //添加姓名
        QTableWidgetItem *qtwi=new QTableWidgetItem();

        qtwi->setText(real_name);//设置单元格中的文本
        qtwi->setFont(font);
        qtwi->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
        qtwi->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
        ui->tableWidget->setItem(sign1,0,qtwi);


        //权限 身份
        QTableWidgetItem *qtwi2=new QTableWidgetItem();

        qtwi2->setText(role);//设置单元格中的文本
        qtwi2->setFont(font);
        qtwi2->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
        qtwi2->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
        ui->tableWidget->setItem(sign1,1,qtwi2);

        //账号
        QTableWidgetItem *qtwi3=new QTableWidgetItem();

        qtwi3->setText(username);//设置单元格中的文本
        qtwi3->setFont(font);
        qtwi3->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
        qtwi3->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
        ui->tableWidget->setItem(sign1,2,qtwi3);

        //指静脉
        QTableWidgetItem *qtwi4=new QTableWidgetItem();
        QString iffingerprint_path = obj1.value("fingerprint_path").toString();
        if(iffingerprint_path.isEmpty())
        {
//            qtwi4->setText("无");//设置单元格中的文本
        }
        else
        {
            qtwi4->setText("有");//设置单元格中的文本
        }
        qtwi4->setFont(font);
        qtwi4->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
        qtwi4->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
        ui->tableWidget->setItem(sign1,3,qtwi4);

        if(ifsign == 0)
        {
            //电子签名
//            QTableWidgetItem *qtwi5=new QTableWidgetItem();
            QString ifsignature_path = obj1.value("signature_path").toString();
            if(!ifsignature_path.isEmpty())
            {
                ifsign = 1;
                signature_pathNumber = i+1;
                QString URL_Name=URLName(QString("/upload/%1").arg(ifsignature_path));//获取文件http网址

                QNetworkAccessManager *manager=new QNetworkAccessManager(this);
    //            connect(&manager,SIGNAL(finished(QNetworkReply *)),this,SLOT(recvhttp(QNetworkReply *)));//关联finished信号

                QUrl url(URL_Name);
                //创建http请求
                QNetworkRequest req(url);
    //             req.setRawHeader("token",bytes);
                //发送该请求
                reply=manager->get(req);

    //            receDigitalVeinUser++;
                //下面关联信号和槽
                connect(reply,SIGNAL(finished()),this,SLOT(httpFinished()));//下载完成后
                connect(reply,SIGNAL(readyRead()),this,SLOT(httpReadyRead()));//有可用数据时
            }
            else
            {
                signature_pathNumber2++;
            }
        }

        //联系方式
        QTableWidgetItem *qtwi6=new QTableWidgetItem();
        qtwi6->setText(obj1.value("phone").toString());//设置单元格中的文本
        qtwi6->setFont(font);
        qtwi6->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
        qtwi6->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
        ui->tableWidget->setItem(sign1,5,qtwi6);

        //创建时间
        QTableWidgetItem *qtwi7=new QTableWidgetItem();
        QString create_time = obj1.value("create_time").toString();
        QStringList create = create_time.split("T");
        if(create.size() >= 2)
        {
            QString createT = create.at(0);
            QStringList creates = create.at(1).split(":");
            if(creates.size() >= 2)
            {
                QString createS = creates.at(0)+":"+creates.at(1);
                qtwi7->setText(QString("%1 %2").arg(createT).arg(createS));//设置单元格中的文本
                qtwi7->setFont(font);
                qtwi7->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
                qtwi7->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
                ui->tableWidget->setItem(sign1,6,qtwi7);
            }

        }


        //用户状态
        QTableWidgetItem *qtwi8=new QTableWidgetItem();

        if(is_disable==0)
        {
            qtwi8->setText("已启用");//设置单元格中的文本
        }
        else
        {
            qtwi8->setText("已禁用");
        }
        qtwi8->setFont(font);
        qtwi8->setForeground(QBrush(QColor(102, 102, 102)));//设置单元格中字体的颜色
        qtwi8->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
        ui->tableWidget->setItem(sign1,7,qtwi8);


        // 创建QPushButton控件
        OperateItem *pOperateItem = new OperateItem(this);
        connect(pOperateItem,SIGNAL(sendOperateItem(QString)),this,SLOT(receOperateItem(QString)));




//        QPushButton *pBtn = new QPushButton();
        if(is_disable==0)
        {
            pOperateItem->setText("禁用");
//            pBtn->setText("禁用");
//            pBtn->setStyleSheet("background:rgba(255, 255, 255, 0%);color: rgb(27, 137, 204);");
//            pBtn->setFont(font);
        }
        else
        {
            pOperateItem->setText("启用");
//            pBtn->setText("启用");
//            pBtn->setStyleSheet("background:rgba(255, 255, 255, 0%);color: rgb(27, 137, 204);");
//            pBtn->setFont(font);
        }
//        // 绑定信号
//        connect(pBtn, SIGNAL(clicked(bool)), this, SLOT(OnBtnClicked()));
//        // 在QTableWidget中添加控件
//        ui->tableWidget->setCellWidget(sign1,8,pBtn);
        ui->tableWidget->setCellWidget(sign1,8,pOperateItem);

//        // 创建QPushButton控件
//        QPushButton *pBtn2 = new QPushButton();
//        pBtn2->setText("重置密码");
//        pBtn2->setStyleSheet("background:rgba(255, 255, 255, 0%);color: rgb(27, 137, 204);");
//        pBtn2->setFont(font);
//        // 绑定信号
//        connect(pBtn2, SIGNAL(clicked(bool)), this, SLOT(OnBtnClicked2()));
//        // 在QTableWidget中添加控件
//        ui->tableWidget->setCellWidget(sign1,9,pBtn2);

//        // 创建QPushButton控件
//        QPushButton *pBtn3 = new QPushButton();
//        pBtn3->setText("修改信息");
//        pBtn3->setStyleSheet("background:rgba(255, 255, 255, 0%);color: rgb(27, 137, 204);");
//        pBtn3->setFont(font);
//        // 绑定信号
//        connect(pBtn3, SIGNAL(clicked(bool)), this, SLOT(OnBtnClicked3()));
//        // 在QTableWidget中添加控件
//        ui->tableWidget->setCellWidget(sign1,10,pBtn3);

        sign1++;
    }


}

bool UserManage::eventFilter(QObject *watched, QEvent *event)
{
    if(ui->pushButton==watched)
    {
        if(QEvent::Enter==event->type())
        {
            ui->pushButton->setStyleSheet("background: #F1F6F9;border: 1px solid #3699FF;border-radius: 15px;font-size: 16px;font-family: Microsoft YaHei;color: #1B89CC;");
            ui->pushButton->setIcon(QPixmap(":/new/prefix1/resource/20.png"));
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            ui->pushButton->setStyleSheet("background: #F1F6F9;border-radius: 15px;font-size: 16px;font-family: Microsoft YaHei;color: #333333;");
            ui->pushButton->setIcon(QPixmap(":/new/prefix1/resource/11.png"));
            setCursor(Qt::ArrowCursor); //设置默认鼠标样式
        }
    }
    if(ui->pushButton_2==watched)
    {
        if(QEvent::Enter==event->type())
        {
            ui->pushButton_2->setStyleSheet("background: #F1F6F9;border: 1px solid #3699FF;border-radius: 15px;font-size: 16px;font-family: Microsoft YaHei;color: #1B89CC;padding-left:2px;padding-bottom:3px;");

//            QCursor cursor(QPixmap(":/new/prefix1/resource/18.png"), -1, -1); //-1 -1表示鼠标热点在中心点
//            setCursor(cursor); //设置自定义的鼠标样式
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            ui->pushButton_2->setStyleSheet("background: #F1F6F9;border-radius: 15px;font-size: 16px;font-family: Microsoft YaHei;color: #333333;padding-left:2px;padding-bottom:3px;");
            setCursor(Qt::ArrowCursor); //设置默认鼠标样式
        }
    }
    if(ui->pushButton_3==watched)
    {
        if(QEvent::Enter==event->type())
        {
            ui->pushButton_3->setStyleSheet("background: #F1F6F9;border: 1px solid #3699FF;border-radius: 15px;font-size: 16px;font-family: Microsoft YaHei;color: #1B89CC;padding-left:2px;padding-bottom:3px;");
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            ui->pushButton_3->setStyleSheet("background: #F1F6F9;border-radius: 15px;font-size: 16px;font-family: Microsoft YaHei;color: #333333;padding-left:2px;padding-bottom:3px;");
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }
    if(ui->comboBox==watched)
    {
        if(QEvent::Enter==event->type())
        {
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }
    if(ui->comboBox_2==watched)
    {
        if(QEvent::Enter==event->type())
        {
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }

    if(ui->pbl==watched)
    {
        if(QEvent::Enter==event->type())
        {
            if(ifpbl == 1)
            {
                setCursor(Qt::PointingHandCursor); //设置鼠标样式
            }

        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }
    if(ui->pbr==watched)
    {
        if(QEvent::Enter==event->type())
        {
            if(ifpbr == 1)
            {
                setCursor(Qt::PointingHandCursor); //设置鼠标样式
            }
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }
    if(ui->pb1==watched)
    {
        if(QEvent::Enter==event->type())
        {
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }
    if(ui->pb2==watched)
    {
        if(QEvent::Enter==event->type())
        {
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }
    if(ui->pb3==watched)
    {
        if(QEvent::Enter==event->type())
        {
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }
    if(ui->pb4==watched)
    {
        if(QEvent::Enter==event->type())
        {
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }
    if(ui->pb5==watched)
    {
        if(QEvent::Enter==event->type())
        {
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标样式
        }
    }
    return QObject::eventFilter(watched,event);
}

void UserManage::receMessage2(QString data)
{
    if(data == "2")
    {
        //点击了否，退出
    }
    else if(data == "3")
    {
        QNetworkRequest request;
        QNetworkAccessManager* naManager = new QNetworkAccessManager(this);
        connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(actionFinished2(QNetworkReply*)));

        QString urlstr = URLName_2(QString("update-action/?%1").arg(resetPassword));

        qDebug() << __LINE__ << "urlstr=" << urlstr;

        request.setUrl(QUrl::fromUserInput(urlstr));
    //    qDebug()<<__LINE__<<"bytes="<<bytes;
        request.setRawHeader("token",bytes);

        naManager->get(request);//发起get请求
    }

}

//自定义新建用户接收槽函数
void UserManage::receUserMan(QString data)
{
    closeShadeWindow();//关闭遮罩窗口

    if(data == "1")
    {
        //新建用户界面点击了确定按钮
        emit sendManMain(1, location);//发送刷新所有用户信息
    }
    else if(data == "2")
    {
        //新建用户界面点击了关闭按钮
    }
}

//自定义修改用户接收槽函数
void UserManage::receAmendMan(QString data)
{
    closeShadeWindow();//关闭遮罩窗口

    if(data == "1")
    {
        //修改用户界面点击了确定按钮
        emit sendManMain(2, location);//发送刷新所有用户信息
    }
    else if(data == "2")
    {
        //修改用户界面点击了关闭按钮
    }
}

void UserManage::receOperateItem(QString data)
{
    QWidget *w_parent = (QWidget*)sender();
    int x = w_parent->frameGeometry().x();
    int y = w_parent->frameGeometry().y();
    QModelIndex index = ui->tableWidget->indexAt(QPoint(x,y));
    int row = index.row();
    int col = index.column();


    if(data == "1")
    {
        OnBtnClicked(row,col,w_parent);
    }
    else if(data == "2")
    {
        OnBtnClicked2(row,col);
    }
    else if(data == "3")
    {
        OnBtnClicked3(row,col);
    }
}

void UserManage::receLComboBox(int n, QString)
{
    if(n == 1)
    {
        analysisMedicalWorkers(medicalWorkersData);
    }
}

//接收数据时的处理
void UserManage::httpReadyRead()
{
//    qDebug()<<__LINE__;
    QByteArray buf = reply->readAll();
    signatureImage.append(buf);
}

void UserManage::httpFinished2()
{
//    QByteArray buf=reply->readAll();
//    qDebug()<<__LINE__<<buf;
//    if (Veinfile)
//        Veinfile->write(reply->readAll());  //如果文件存在，则写入文件

    Veinfile->flush();
    Veinfile->close();
    reply2->deleteLater();
    reply2 = 0;
    delete Veinfile;
    Veinfile = 0;

    //把接收到的指静脉文件更新到指静脉设备里
    int ret = thread->setUserOne(DigitalVeinUserPath);//更新一个用户
    if(ret <= 0)
    {
        //更新指静脉信息失败 删除该文件
        OperationDocument::DeleteFileOrFolder(DigitalVeinUserPath);
    }

    qDebug()<<__LINE__;
    //继续判断是否还需要更新指静脉文件
    QString dirPath=QString("%1/DigitalVeinUser/").arg(MY_PATH);
    for(;receDigitalVeinUser<valDigitalVeinUser.size();receDigitalVeinUser++)
    {
        //obj1存放的就是数组中一个医护人员信息
        QJsonObject  obj1=valDigitalVeinUser.at(receDigitalVeinUser).toObject();

        int ifFile=0;//用来判断文件是否存在
        //文件路径
        QJsonValue val4=obj1.value("fingerprint_path");
        if(val4.toString().isEmpty())
        {
            continue;
        }
        for(int j=0;j<FingerVeinName.size();j++)
        {
            if(val4.toString()==FingerVeinName.at(j))
            {
                //找到指静脉文件，再次判断指静脉信息之前是否成功录入  没有成功录入再次录入
                int uid = obj1.value("digital_vein_device_id").toInt();
                int ret = thread->isUid(uid);
                if(ret < 0)
                {
                    qDebug()<<__LINE__<<"指静脉文件存在，信息不存在，重新下载录入信息"<<uid<<j;
                    ifFile = 0;
                }
                else
                {
                    ifFile = 1;
                }
                break;
            }
        }

        if(ifFile==0)
        {
            //说明该文件不存在,从服务器获取该文件
            qDebug()<<__LINE__<<val4.toString();

            DigitalVeinUserPath=QString("%1%2").arg(dirPath).arg(val4.toString());//文件绝对路径

//            allpath=QString("%1%2").arg(dirPath).arg("qq.png");//文件绝对路径


            Veinfile=new QFile(DigitalVeinUserPath);
            if(!Veinfile->open(QIODevice::WriteOnly))
            {
                //如果打开文件失败，则删除file，并使file指针为0，然后返回
                qDebug()<<"文件打开失败"<<val4.toString();
                delete Veinfile;
                Veinfile=0;
                continue;
            }

            QString URL_Name=URLName(QString("/upload/%1").arg(val4.toString()));//获取文件http网址
//            URL_Name=QString("http://192.168.3.109:8888/upload/39f56e19b5a64e50830cae03b4a43a01.png");//获取文件http网址


            QNetworkAccessManager *manager=new QNetworkAccessManager(this);
//            connect(&manager,SIGNAL(finished(QNetworkReply *)),this,SLOT(recvhttp(QNetworkReply *)));//关联finished信号

            QUrl url(URL_Name);
            //创建http请求
            QNetworkRequest req(url);
//             req.setRawHeader("token",bytes);
            //发送该请求
            reply2=manager->get(req);

            receDigitalVeinUser++;

            //下面关联信号和槽
            connect(reply2,SIGNAL(finished()),this,SLOT(httpFinished2()));//下载完成后
            connect(reply2,SIGNAL(readyRead()),this,SLOT(httpReadyRead2()));//有可用数据时


            break;
        }
    }
}

void UserManage::httpReadyRead2()
{
    if (Veinfile)
    {
        Veinfile->write(reply2->readAll());  //如果文件存在，则写入文件
    }
}

//禁用或者启用用户
void UserManage::actionFinished(QNetworkReply *reply)
{
    QByteArray buf = reply->readAll();
    qDebug()<<__LINE__<<"buf="<<QString(buf);

    //把获取的json数据标准化存储
    QJsonParseError myerr;
    QJsonDocument mydoc=QJsonDocument::fromJson(buf,&myerr);

    //获取最外面的对象
    QJsonObject obj=mydoc.object();

    QString message=obj.value("message").toString();
    if(message == "修改成功")
    {
        qDebug()<<__LINE__<<"修改成功";

    }
    emit sendManMain(1, location);//发送刷新所有用户信息
}

//重置密码
void UserManage::actionFinished2(QNetworkReply *reply)
{
    QByteArray buf = reply->readAll();
    qDebug()<<__LINE__<<"buf="<<QString(buf);

    //把获取的json数据标准化存储
    QJsonParseError myerr;
    QJsonDocument mydoc=QJsonDocument::fromJson(buf,&myerr);

    //获取最外面的对象
    QJsonObject obj=mydoc.object();

    QString message=obj.value("message").toString();
    if(message == "重置成功")
    {
//        qDebug()<<__LINE__<<"重置密码成功";
        mps->setText("重置密码成功");
        mps->show();
    }
    else
    {
        mps->setText("重置密码失败");
        mps->show();
    }
}

//完成下载后的处理
void UserManage::httpFinished()
{
    reply->deleteLater();
    reply = 0;

    QPixmap map;
    map.loadFromData(signatureImage);
//    map.scaled(label->width(),label->height());
//    label->setScaledContents(true);
//    label->setPixmap(map);
//    label->setAlignment(Qt::AlignCenter);//图片居中显示
//    ui->tableWidget->setCellWidget(signature_pathNumber2,4,label);

    DeviceItem* pDeviceItem1 = new DeviceItem();
    pDeviceItem1->setIcon(map);
    ui->tableWidget->setCellWidget(signature_pathNumber2,4,pDeviceItem1);

    signature_pathNumber2++;
    signatureImage.clear();

    //把获取的json数据标准化存储
    QJsonParseError myerr;
    QJsonDocument mydoc=QJsonDocument::fromJson(medicalWorkersData,&myerr);


    //获取最外面的对象
    QJsonObject obj=mydoc.object();

    //obj存放的就是
     //继续获取键值对中的键和值(数组)
 //   QJsonObject  obj1=obj.toObject();
    QJsonArray val=obj.value("data").toArray();

    //获取QComboBox列表项的当前项的文字
    QString permission = comboBoxText(lComboBox);//权限
    QString state = comboBoxText(lComboBox2);//用户状态
    QString name = ui->lineEdit->text();//姓名
    QString account = ui->lineEdit_2->text();//账号

    for(int i=signature_pathNumber; i<val.size(); i++)
    {
        QJsonObject  obj1=val.at(i).toObject();

        QString real_name = obj1.value("real_name").toString();
        if(!real_name.contains(name))   continue;

        QString role = obj1.value("role").toString();
        if(permission != "全部")
        {
            if(!role.contains(permission))   continue;
        }

        QString username = obj1.value("username").toString();
        if(!username.contains(account))   continue;

        int is_disable = obj1.value("is_disable").toInt();
        if(state != "全部")
        {
            if(is_disable==0)
            {
                if(state == "已禁用")
                    continue;
            }
            else if(is_disable==1)
            {
                if(state == "已启用")
                    continue;
            }
        }

        QString ifsignature_path = obj1.value("signature_path").toString();
        if(!ifsignature_path.isEmpty())
        {
            signature_pathNumber = i+1;
            QString URL_Name=URLName(QString("/upload/%1").arg(ifsignature_path));//获取文件http网址

            QNetworkAccessManager *manager=new QNetworkAccessManager(this);
//            connect(&manager,SIGNAL(finished(QNetworkReply *)),this,SLOT(recvhttp(QNetworkReply *)));//关联finished信号

            QUrl url(URL_Name);
            //创建http请求
            QNetworkRequest req(url);
//             req.setRawHeader("token",bytes);

            //发送该请求
            reply=manager->get(req);

//            receDigitalVeinUser++;
            //下面关联信号和槽
            connect(reply,SIGNAL(finished()),this,SLOT(httpFinished()));//下载完成后
            connect(reply,SIGNAL(readyRead()),this,SLOT(httpReadyRead()));//有可用数据时
            break;
        }
        else
        {
            signature_pathNumber2++;
        }
    }
}

// 绑定的响应函数
void UserManage::OnBtnClicked(int row, int column, QWidget *w_parent)
{
    OperateItem *parent = (OperateItem *)w_parent;
//    QPushButton *pushButton_ = dynamic_cast<QPushButton*>(this->sender());
//    if(NULL == pushButton_)
//    {
//        return;
//    }
//    int x = pushButton_->frameGeometry().x();
//    int y = pushButton_->frameGeometry().y();
//    QModelIndex index = ui->tableWidget->indexAt(QPoint(x, y));
//    int row = index.row();
//    int column = index.column();

    qDebug() << "选择第几行:" << row << "选择第几列:" << column<<"账号="<<ui->tableWidget->item(row,2)->text();

    //接下来自定义要处理的
    int id = -1;
    QString username = ui->tableWidget->item(row,2)->text();
    for(int i=0;i<valDigitalVeinUser.size();i++)
    {
        //obj1存放的就是数组中一个医护人员信息
        QJsonObject  obj1=valDigitalVeinUser.at(i).toObject();

        //文件路径
        QString val4=obj1.value("username").toString();
        if(username == val4)
        {
            id = obj1.value("id").toInt();
            break;
        }

    }
    if(id == -1)
    {
        qDebug()<<__LINE__<<"没有这个id";
        return;
    }

    QString byte_array;
//    QJsonObject object;
//    object.insert("type","disable");
//    object.insert("id",id);

    if(parent->text() == "禁用")
    {
        byte_array = QString("id=%1&type=disable&code=1").arg(id);
//        object.insert("code",1);
        QTableWidgetItem *qtwi=new QTableWidgetItem();
        qtwi->setText("已禁用");//设置单元格中的文本
        qtwi->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
        ui->tableWidget->setItem(row,7,qtwi);
        parent->setText("启用");
    }
    else if(parent->text() == "启用")
    {
        byte_array = QString("id=%1&type=disable&code=0").arg(id);
//        object.insert("code",0);
        QTableWidgetItem *qtwi=new QTableWidgetItem();
        qtwi->setText("已启用");//设置单元格中的文本
        qtwi->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);//设置单元格中文本的对齐方式
        ui->tableWidget->setItem(row,7,qtwi);
        parent->setText("禁用");
    }

    QNetworkRequest request;
    QNetworkAccessManager* naManager = new QNetworkAccessManager(this);
    connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(actionFinished(QNetworkReply*)));

//    request.setHeader(QNetworkRequest::ContentTypeHeader,QVariant("application/json"));

    QString urlstr = URLName_2(QString("update-action/?%1").arg(byte_array));

    qDebug() << __LINE__ << "urlstr=" << urlstr;

    request.setUrl(QUrl::fromUserInput(urlstr));
//    qDebug()<<__LINE__<<"bytes="<<bytes;
    request.setRawHeader("token",bytes);

    naManager->get(request);//发起get请求
//qDebug()<<__LINE__;
}

// 绑定的响应函数
void UserManage::OnBtnClicked2(int row, int column)
{

//    QPushButton *pushButton_ = dynamic_cast<QPushButton*>(this->sender());
//    if(NULL == pushButton_)
//    {
//        return;
//    }
//    int x = pushButton_->frameGeometry().x();
//    int y = pushButton_->frameGeometry().y();
//    QModelIndex index = ui->tableWidget->indexAt(QPoint(x, y));
//    int row = index.row();
//    int column = index.column();

    qDebug() << "选择第几行:" << row << "选择第几列:" << column;

    //接下来自定义要处理的
    int id = -1;
    QString username = ui->tableWidget->item(row,2)->text();
    for(int i=0;i<valDigitalVeinUser.size();i++)
    {
        //obj1存放的就是数组中一个医护人员信息
        QJsonObject  obj1=valDigitalVeinUser.at(i).toObject();

        //文件路径
        QString val4=obj1.value("username").toString();
        if(username == val4)
        {
            id = obj1.value("id").toInt();
            break;
        }

    }
    if(id == -1)
    {
        qDebug()<<__LINE__<<"没有这个id";
        return;
    }

    resetPassword = QString("id=%1&type=reset").arg(id);

//    QString markedWord = QString("您正在重置%1的密码，重置密码为联系方式的后8位，请问是否继续？").arg(username);
//    qDebug()<<__LINE__<<"markedWord.size="<<markedWord.size();
//    QString markedWords;
//    markedWords=markedWord.mid(0,13);
//    markedWords+="@#";
//    markedWords+=markedWord.mid(13,13);
//    markedWords+="@#";
//    markedWords+=markedWord.mid(26,markedWord.size()-26);
//    for(int i=markedWord.size();i<39;i++)
//    {
//        markedWords+="  ";
//    }
    QString markedWords = "您正在重置密码,重置密码@#为联系方式的后8位,请问@#是否继续";
    mps2->setTexts(markedWords);
    mps2->show();
    qDebug()<<__LINE__<<"markedWords="<<markedWords;
}

// 绑定的响应函数
void UserManage::OnBtnClicked3(int row, int column)
{

//    QPushButton *pushButton_ = dynamic_cast<QPushButton*>(this->sender());
//    if(NULL == pushButton_)
//    {
//        return;
//    }
//    int x = pushButton_->frameGeometry().x();
//    int y = pushButton_->frameGeometry().y();
//    QModelIndex index = ui->tableWidget->indexAt(QPoint(x, y));
//    int row = index.row();
//    int column = index.column();

    qDebug() << "选择第几行:" << row << "选择第几列:" << column;

    //接下来自定义要处理的
    int id=-1;
    QJsonObject userinfo;
    QString username = ui->tableWidget->item(row,2)->text();
    QString gatherName;
    QString gender;
    QString accountNumber_;
    QString phone;//联系方式
    QString role;//权限
    QString signature_path;//签名图片

    int digital_vein_device_id;//指静脉id
//qDebug()<<__LINE__<<valDigitalVeinUser;
    for(int i=0;i<valDigitalVeinUser.size();i++)
    {
        //obj1存放的就是数组中一个医护人员信息
        userinfo=valDigitalVeinUser.at(i).toObject();

        //文件路径
        QString val4=userinfo.value("username").toString();
        if(username == val4)
        {
            id = userinfo.value("id").toInt();
            gatherName = userinfo.value("real_name").toString();
            gender = userinfo.value("gender").toString();
            accountNumber_ = userinfo.value("username").toString();
            digital_vein_device_id = userinfo.value("digital_vein_device_id").toInt();
            role = userinfo.value("role").toString();
            phone = userinfo.value("phone").toString();
            signature_path = userinfo.value("signature_path").toString();


            break;
        }
    }
    if(id == -1)
    {
        qDebug()<<__LINE__<<"没有该用户";
        emit sendManMain(1, location);//发送刷新所有用户信息
        return;
    }

    showShadeWindow();//显示遮罩窗口

    QWidget *parentWidget=this->parentWidget();

    amenduser = new amendUser(this);
    connect(amenduser,SIGNAL(sendAmendMan(QString)),this,SLOT(receAmendMan(QString)));
//    amenduser->setGeometry(580,150,470,610);//设置坐标和宽高
//    qDebug()<<__LINE__<<"bytes="<<bytes;
    amenduser->setThread(thread,bytes,accountNumber,parentWidget);//把指静脉线程对象传过去
    amenduser->setUser(gatherName,gender,accountNumber_,digital_vein_device_id,role,phone,signature_path);//设置用户基础信息 (姓名，性别，账号,权限，联系方式)
    amenduser->exec();
}

//显示遮罩窗口
void UserManage::showShadeWindow()
{
    QWidget *parentWidget=this->parentWidget();
    mpShadeWindow->setGeometry(0, 0, parentWidget->width(), parentWidget->height());
    mpShadeWindow->show();
}

//关闭遮罩窗口
void UserManage::closeShadeWindow()
{
    mpShadeWindow->hide();
    mpShadeWindow->setGeometry(0,0,1,1);
}

//姓名输入框按下回车
void UserManage::on_lineEdit_returnPressed()
{
    analysisMedicalWorkers(medicalWorkersData);
}

//账号输入框按下回车
void UserManage::on_lineEdit_2_returnPressed()
{
    analysisMedicalWorkers(medicalWorkersData);
}

//点击搜索按钮
void UserManage::on_pushButton_3_clicked()
{
    analysisMedicalWorkers(medicalWorkersData);
}

//点击权限下拉框
void UserManage::on_comboBox_activated(const QString &)
{
    analysisMedicalWorkers(medicalWorkersData);
}

//点击用户状态下拉框
void UserManage::on_comboBox_2_activated(const QString &)
{
    analysisMedicalWorkers(medicalWorkersData);
}

//点击重置按钮
void UserManage::on_pushButton_2_clicked()
{
    ui->lineEdit->clear();
    ui->lineEdit_2->clear();
//    ui->comboBox->setCurrentIndex(0);//设置当前项为第一项
//    ui->comboBox_2->setCurrentIndex(0);
    lComboBox->reset();
    lComboBox2->reset();

    emit sendManMain(1, 1);//发送刷新所有用户信息
//    analysisMedicalWorkers(medicalWorkersData);
}

//点击新建用户按钮
void UserManage::on_pushButton_clicked()
{
//    QStringList uidList = gainUid();
    showShadeWindow();//显示遮罩窗口

    QWidget *parentWidget=this->parentWidget();

    newuser = new newUser(this);

    connect(newuser,SIGNAL(sendUserMan(QString)),this,SLOT(receUserMan(QString)));
//    newuser->setGeometry(580,150,470,610);//设置坐标和宽高
    newuser->setThread(thread,bytes,accountNumber,parentWidget);//把指静脉线程对象传过去
    newuser->show();


//    QScopedPointer<QWidget>shadow(new QWidget(this));
//    shadow->setFixedSize(size());
//    QPalette pal(shadow->palette());
//    pal.setColor(QPalette::Background, QColor(0, 0, 0, 90));
//    shadow->setAutoFillBackground(true);
//    shadow->setPalette(pal);
//    shadow->stackUnder(this);
//    shadow->setVisible(true);
}

//翻页触发槽函数
void UserManage::FlipOver()
{
    //获取信号的发送者
    QPushButton *ret=(QPushButton *)sender();

//    setPbStyleSheet();

//    ret->setStyleSheet("background: #1B89CC;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #FBFBFB;");
    location = ret->text().toInt();

    showButton();
}

//左翻页槽函数
void UserManage::LeftOver()
{
//    setPbStyleSheet();

    location--;

    if(location <= 1)
    {
        ui->pbl->setStyleSheet("border: 1px solid #999999;border-radius: 10px;");
        setCursor(Qt::ArrowCursor); //设置默认鼠标样式
    }
    else
    {
        ui->pbl->setStyleSheet("border: 1px solid #666666;border-radius: 10px;");
    }
    if(location >= pagination)
    {
        ui->pbr->setStyleSheet("border: 1px solid #999999;border-radius: 10px;");
        setCursor(Qt::ArrowCursor); //设置默认鼠标样式
    }
    else
    {
        ui->pbr->setStyleSheet("border: 1px solid #666666;border-radius: 10px;");
    }
    showButton();
}

//右翻页槽函数
void UserManage::RightOver()
{
//    setPbStyleSheet();

    location++;

    if(location <= 1)
    {
        ui->pbl->setStyleSheet("border: 1px solid #999999;border-radius: 10px;");
        setCursor(Qt::ArrowCursor); //设置默认鼠标样式
    }
    else
    {
        ui->pbl->setStyleSheet("border: 1px solid #666666;border-radius: 10px;");
    }
    if(location >= pagination)
    {
        ui->pbr->setStyleSheet("border: 1px solid #999999;border-radius: 10px;");
        setCursor(Qt::ArrowCursor); //设置默认鼠标样式
    }
    else
    {
        ui->pbr->setStyleSheet("border: 1px solid #666666;border-radius: 10px;");
    }
    showButton();
}

//设置QComboBox样式
void UserManage::setcomboBox(QComboBox *comboBox)
{
    comboBox->setView(new QListView());
    QStyledItemDelegate* itemDelegate = new QStyledItemDelegate();
    comboBox->setItemDelegate(itemDelegate);

    //设置标题字间距,外阴影
    QFont font;
    font.setFamily(QStringLiteral("Microsoft YaHei"));//设置字体
    font.setPixelSize(15);//字体大小
    font.setLetterSpacing(QFont::PercentageSpacing,120);//120字间距，默认100
    comboBox->setFont(font);

    QAbstractItemView* view = comboBox->view();
    view->setFont(font);//设置标题字间距
    QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect;
    effect->setBlurRadius(10);//阴影半径
//    effect->setColor(Qt::black);
    effect->setColor(QColor(38, 78, 119, 127));//阴影颜色
    effect->setOffset(0, 0);


    view->setGraphicsEffect(effect);
    view->update();

    static_cast<QDialog*>(view->parent())->setStyleSheet("QDialog{border:none;background-color: rgb(255, 255, 255);}");

    QDialog* container = static_cast<QDialog*>(view->parent());
//    container->setAttribute(Qt::WA_TranslucentBackground);//设置窗口透明
    container->setWindowFlag(Qt::FramelessWindowHint);
    container->setWindowFlag(Qt::NoDropShadowWindowHint);

}

////获取所有用户UID
//QStringList UserManage::gainUid()
//{
//    QStringList uidList;
//    //把获取的json数据标准化存储
//    QJsonParseError myerr;
//    QJsonDocument mydoc=QJsonDocument::fromJson(medicalWorkersData,&myerr);

//    QJsonObject obj=mydoc.object();
//    QJsonArray val=obj.value("data").toArray();

//    for(int i=0; i<val.size(); i++)
//    {
//        QJsonObject  obj1=val.at(i).toObject();

//        //obj1存放的就是数组中一个医护人员信息
//        QJsonValue val1=obj1.value("digital_vein_device_id");
//        if(!val1.isNull())
//        {
//            int digital_vein_device_id = val1.toInt();
//            uidList.append(QString::number(digital_vein_device_id));
//        }

//    }

//    qDebug()<<__LINE__<<"uidList="<<uidList;
//    return uidList;
//}

//刷新指静脉信息，查看是否有新的指静脉文件
void UserManage::RefreshFingerVein()
{
    int ret = thread->ifDevHandle();
    if(ret <= 0)
    {
        return;
    }
    QString dirPath=QString("%1DigitalVeinUser/").arg(MY_PATH);
    //创建QDir的对象
    QDir mydir(dirPath);

    //遍历目录，打印目录中的内容
    QStringList filelist=mydir.entryList();

    FingerVeinName.clear();
    for(int i=0; i<filelist.size(); i++)
    {
        //判断文件是不是txt
        QFileInfo fileinfo(filelist.at(i));
        QString str=fileinfo.suffix();

//        if(filelist.at(i)=="."||filelist.at(i)==".."||str!="txt")
        if(filelist.at(i)=="."||filelist.at(i)=="..")
        {
            continue;
        }
//        qDebug()<<"当前遍历的目录内容是: "<<filelist.at(i);

        QString filename2 = filelist.at(i);//文件名称
        FingerVeinName.append(filename2);
    }


    //把获取的json数据标准化存储
    QJsonParseError myerr;
    QJsonDocument mydoc=QJsonDocument::fromJson(medicalWorkersData,&myerr);

    //获取最外面的对象
    QJsonObject obj=mydoc.object();
     //继续获取键值对中的键和值(数组)
    valDigitalVeinUser=obj.value("data").toArray();
//qDebug()<<__LINE__<<valDigitalVeinUser;
    for(int i=0;i<FingerVeinName.size();i++)
    {
        int ifFile=0;//用来判断文件是否存在
        for(int j=0;j<valDigitalVeinUser.size();j++)
        {
            //obj1存放的就是数组中一个医护人员信息
            QJsonObject  obj1=valDigitalVeinUser.at(j).toObject();
            //文件路径
            QJsonValue val4=obj1.value("fingerprint_path");
            if(val4.toString()==FingerVeinName.at(i))
            {
                ifFile=1;
                break;
            }
        }

        if(ifFile==0)
        {
            //说明服务器没有该文件，在本地也删除该文件
            qDebug()<<__LINE__<<FingerVeinName.at(i);

            QString filePath=QString("%1%2").arg(dirPath).arg(FingerVeinName.at(i));

            thread->DeletingUsersOne(filePath);//从指静脉设备中删除该用户信息

            DeleteFileOrFolder(filePath);

//            thread->DeletingUsersOne(filePath);//从指静脉设备中删除该用户信息
        }
    }

    for(receDigitalVeinUser=0;receDigitalVeinUser<valDigitalVeinUser.size();receDigitalVeinUser++)
    {
        //obj1存放的就是数组中一个医护人员信息
        QJsonObject  obj1=valDigitalVeinUser.at(receDigitalVeinUser).toObject();

        int ifFile=0;//用来判断文件是否存在
        //文件路径
        QJsonValue val4=obj1.value("fingerprint_path");
        if(val4.toString().isEmpty())
        {
            continue;
        }
        for(int j=0;j<FingerVeinName.size();j++)
        {
            if(val4.toString()==FingerVeinName.at(j))
            {
                //找到指静脉文件，再次判断指静脉信息之前是否成功录入  没有成功录入再次录入
                int uid = obj1.value("digital_vein_device_id").toInt();
                int ret = thread->isUid(uid);
                if(ret < 0)
                {
                    qDebug()<<__LINE__<<"指静脉文件存在，信息不存在，重新下载录入信息"<<uid<<j;
                    ifFile = 0;
                }
                else
                {
                    ifFile = 1;
                }
                break;
            }
        }

        if(ifFile==0)
        {
            //说明该文件不存在,从服务器获取该文件
            qDebug()<<__LINE__<<val4.toString();

            DigitalVeinUserPath=QString("%1%2").arg(dirPath).arg(val4.toString());//文件绝对路径

            Veinfile=new QFile(DigitalVeinUserPath);
            if(!Veinfile->open(QIODevice::WriteOnly))
            {
                //如果打开文件失败，则删除file，并使file指针为0，然后返回
                qDebug()<<__LINE__<<"文件打开失败"<<DigitalVeinUserPath;
                delete Veinfile;
                Veinfile=0;
                continue;
            }

            QString URL_Name=URLName(QString("/upload/%1").arg(val4.toString()));//获取文件http网址

            QNetworkAccessManager *manager=new QNetworkAccessManager(this);
//            connect(&manager,SIGNAL(finished(QNetworkReply *)),this,SLOT(recvhttp(QNetworkReply *)));//关联finished信号



            QUrl url(URL_Name);
            //创建http请求
            QNetworkRequest req(url);
//             req.setRawHeader("token",bytes);

            //发送该请求
            reply2=manager->get(req);

            receDigitalVeinUser++;

            //下面关联信号和槽
            connect(reply2,SIGNAL(finished()),this,SLOT(httpFinished2()));//下载完成后
            connect(reply2,SIGNAL(readyRead()),this,SLOT(httpReadyRead2()));//有可用数据时
//            connect(reply,SIGNAL(downloadProgress(qint64,qint64)),
//                    this,SLOT(updateDataReadProgress(qint64,qint64)));//更新进度条


            break;
        }
    }


}

bool UserManage::DeleteFileOrFolder(const QString &strPath)
{
    if (strPath.isEmpty() || !QDir().exists(strPath))//是否传入了空的路径||路径是否存在
        return false;

    QFileInfo FileInfo(strPath);

    if (FileInfo.isFile())//如果是文件
        QFile::remove(strPath);
    else if (FileInfo.isDir())//如果是文件夹
    {
        //创建QDir的对象
        QDir mydir(strPath);

    }
    return true;
}

//设置翻页初始样式
void UserManage::setPbStyleSheet()
{
    ui->pb1->setStyleSheet("border: 1px solid #666666;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #666666;");
    ui->pb2->setStyleSheet("border: 1px solid #666666;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #666666;");
    ui->pb3->setStyleSheet("border: 1px solid #666666;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #666666;");
    ui->pb4->setStyleSheet("border: 1px solid #666666;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #666666;");
    ui->pb5->setStyleSheet("border: 1px solid #666666;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #666666;");
}

//设置表格页数小于5页
void UserManage::setNumber(int x, int y, int w, int h, int number)
{
    if(number<=5)
    {
        x = x-51-number*33;
    }
    else
    {
        x = x-51-5*33;
        number=5;
    }

    if(number <= 1)
    {
        ui->pb1->show();
        ui->pb2->hide();
        ui->pb3->hide();
        ui->pb4->hide();
        ui->pb5->hide();

        ui->pbl->setGeometry(x,y,w,h);
        ui->pb1->setGeometry(x+66,y,w,h);
        ui->pbr->setGeometry(x+66*2,y,w,h);
    }
    else if(number == 2)
    {
        ui->pb1->show();
        ui->pb2->show();
        ui->pb3->hide();
        ui->pb4->hide();
        ui->pb5->hide();

        ui->pbl->setGeometry(x,y,w,h);
        ui->pb1->setGeometry(x+66,y,w,h);
        ui->pb2->setGeometry(x+66*2,y,w,h);
        ui->pbr->setGeometry(x+66*3,y,w,h);
    }
    else if(number == 3)
    {
        ui->pb1->show();
        ui->pb2->show();
        ui->pb3->show();
        ui->pb4->hide();
        ui->pb5->hide();

        ui->pbl->setGeometry(x,y,w,h);
        ui->pb1->setGeometry(x+66,y,w,h);
        ui->pb2->setGeometry(x+66*2,y,w,h);
        ui->pb3->setGeometry(x+66*3,y,w,h);
        ui->pbr->setGeometry(x+66*4,y,w,h);
    }
    else if(number == 4)
    {
        ui->pb1->show();
        ui->pb2->show();
        ui->pb3->show();
        ui->pb4->show();
        ui->pb5->hide();

        ui->pbl->setGeometry(x,y,w,h);
        ui->pb1->setGeometry(x+66,y,w,h);
        ui->pb2->setGeometry(x+66*2,y,w,h);
        ui->pb3->setGeometry(x+66*3,y,w,h);
        ui->pb4->setGeometry(x+66*4,y,w,h);
        ui->pbr->setGeometry(x+66*5,y,w,h);
    }
    else if(number >= 5)
    {
        ui->pb1->show();
        ui->pb2->show();
        ui->pb3->show();
        ui->pb4->show();
        ui->pb5->show();

        ui->pbl->setGeometry(x,y,w,h);
        ui->pb1->setGeometry(x+66,y,w,h);
        ui->pb2->setGeometry(x+66*2,y,w,h);
        ui->pb3->setGeometry(x+66*3,y,w,h);
        ui->pb4->setGeometry(x+66*4,y,w,h);
        ui->pb5->setGeometry(x+66*5,y,w,h);
        ui->pbr->setGeometry(x+66*6,y,w,h);
    }


}

//按钮显示位置样式
void UserManage::showButton()
{
    setPbStyleSheet();

    if(location <= 1)
    {
        //禁用左按钮
        ui->pbl->setEnabled(false);
//        setCursor(Qt::ArrowCursor); //设置默认鼠标样式
        ifpbl = 0;
    }
    else
    {
        ui->pbl->setEnabled(true);
        ifpbl = 1;
    }
    if(location >= pagination)
    {
        //禁用右按钮
        ui->pbr->setEnabled(false);
//        setCursor(Qt::ArrowCursor); //设置默认鼠标样式
        ifpbr = 0;
    }
    else
    {
        ui->pbr->setEnabled(true);
        ifpbr = 1;
    }


    if(pagination<=5)
    {
        PB[location-1]->setStyleSheet("background: #1B89CC;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #FBFBFB;");
    }
    else
    {
        if(location<=2)
        {
            for(int i=0;i<5;i++)
            {
                PB[i]->setText(QString::number(i+1));
            }
            PB[location-1]->setStyleSheet("background: #1B89CC;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #FBFBFB;");
        }
        else if((pagination-location)<=2)
        {
            for(int i=0;i<5;i++)
            {
                PB[i]->setText(QString::number(pagination-4+i));
            }
            PB[4-(pagination-location)]->setStyleSheet("background: #1B89CC;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #FBFBFB;");
        }
        else
        {
            for(int i=0;i<5;i++)
            {
                PB[i]->setText(QString::number(location-2+i));
            }
            PB[2]->setStyleSheet("background: #1B89CC;border-radius: 10px;font-size: 18px;font-family: Microsoft YaHei;color: #FBFBFB;");
        }
    }

    analysisMedicalWorkers2(medicalWorkersData, location);
}

QString UserManage::comboBoxText(QComboBox *comboBox)
{
    QString text = comboBox->currentText();
    text = text.replace(" ","");

    return text;
}

//解析获取comboBox选中文本
QString UserManage::comboBoxText(LComboBox *comboBox)
{
    return comboBox->text();
}

void UserManage::on_lineEdit_textChanged(const QString &arg1)
{
    if(arg1.isEmpty())
    {
        OperationDocument::setqss(ui->lineEdit,":/new/prefix1/resource/myStyleSheet2.qss");


    }
    else
    {
        OperationDocument::setqss(ui->lineEdit,":/new/prefix1/resource/myStyleSheet.qss");


    }
}

void UserManage::on_lineEdit_2_textChanged(const QString &arg1)
{
    if(arg1.isEmpty())
    {
        OperationDocument::setqss(ui->lineEdit_2,":/new/prefix1/resource/myStyleSheet2.qss");

    }
    else
    {
        OperationDocument::setqss(ui->lineEdit_2,":/new/prefix1/resource/myStyleSheet.qss");


    }
}
